<template>
  <view class="h-flex h100p">
    <u-tabs-swiper
      ref="uTabs"
      :list="tabs"
      :current="tabIdx"
      @change="onTabsChange"
      :is-scroll="isScroll"
      activeColor="#2d7a3e"
      inactiveColor="#555"
    />

    <swiper
      class="flex-1"
      :current="swiperIdx"
      @transition="onTrans"
      @animationfinish="onAnimFinish"
    >
      <swiper-item class="swiper-item" v-for="(item, i) in tabs" :key="i">
        <scroll-item
          :index="i"
          :active="i == tabIdx"
          :config="{
            ...config,
            ...item,
          }"
          :filterParams="filterParams"
        />
      </swiper-item>
    </swiper>

    <slot name="bottom"></slot>
  </view>
</template>

<script>
import mixin from "./mixin";
import scrollItem from "./scroll-item.vue";

export default {
  mixins: [mixin],
  components: {
    scrollItem,
  },
  props: {
    tabs: Array,
    isScroll: Boolean,
    config: Object,
    filterParams: Object,
    tarTab: {
      type: Number,
      default: 0,
    },
  },
};
</script>
